 <#include "../../common/com.html"/> <@layout>

<!-- ace styles -->
<link rel="stylesheet" href="${ctx}/static/assets/css/ace.min.css" />
<link href='${ctx}/static/assets/css/select2.css' media='all' rel='stylesheet' type='text/css'/>
<script src='${ctx}/static/assets/js/select2.min.js' type='text/javascript'></script>
<script src='${ctx}/static/assets/js/select2_locale_zh-CN.js' type='text/javascript'></script>
<script type="text/javascript">
	/**
	 * 新增
	 */
	function saveModel() {
		var id = document.getElementById("id").value;
		if (Validator.Validate(document.getElementById('form1'))) {
		} else {
			return;
		}

		url = '';
		if (id == "") {
			url = '${ctx}/cpglCk/save';
		} else {
			url = '${ctx}/cpglCk/update';
		}
		$('#form1').form('submit', {
			url : url,
			onSubmit : function() {
				return $(this).form('validate');
			},
			success : function(data) {
				alert(data);
				window.location.href = ' ${ctx}/cpglCk';
			}
		});

	}
</script>
<div class="page-content">
	<div class="row-fluid">
		<div class="span12">
			<form class="form-horizontal" id="form1" method="post">
				<input type="hidden" name="id" id="id">
				<div class="control-group">
					<label class="control-label">商品名称:</label>
					<div class="controls">
						<input id="wpid" name="wpid" type="text" style="min-height: 24px;width:210px" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">出库数量:</label>
					<div class="controls">
						<input id="cksl" name="cksl" type="text"  dataType="Require" msg="请输入出库数量"  class="easyui-numberbox"   style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">出库原因</label>
					<div class="controls">
						<select name="ckyy" id="ckyy"   dataType="Require" msg="请选择出库原因"  style="min-height: 24px;width:210px">
								<option value=""  >无</option>
								<option value="3"  > 领用出库</option>
								<option value="4" >报损出库</option>
							</select>
					</div>
				</div>
	
			</form>
		</div>
		<div class="span12 center">
			<a class="btn btn-info btn-small" onclick="saveModel()">确定 <a
				href="#" class="btn btn-danger btn-small bigger-110"
				onclick="parent.closeDialog();">取消 </a>
		</div>
	</div>
</div>

</body>

<script>
	/**
	 * 修改页面使用
	 */

	<#list newlist as m>
	document.getElementById("wpid").value = '${(m.wpid)!}';
	document.getElementById("cksl").value = '${(m.cksl)!}';
	document.getElementById("ckyy").value = '${(m.ckyy)!}';
	document.getElementById("ckje").value = '${(m.ckje)!}';

	</#list>
	
	 $('#wpid').select2({
	        placeholder: "请输入查询商品名称或者编号",
	        minimumInputLength: 0,
	        ajax: {
	            url: "${ctx}/cgglWp/getWpxx",
	            dataType: 'json',
	            data: function (term, page) {
	                return {
	                    term: term,
	                    page_limit: 20,
	                    page: 0,
	                    apikey: "getwpxx"
	                };
	            },
	            results: function (data, page) {
	                return { results: data};
	            }

	        }
	    });
</script>
</@layout>
